<!--评论管理-->
<template>
  <div>
    <el-table :data="totalData" style="width: 100%" height="calc(100vh - 100px)">
    <el-table-column width="140" align="center"  label="编号"  prop="id"></el-table-column>
    <el-table-column width="140" align="center" label="评论内容" prop="content"></el-table-column>
    <el-table-column width="140" align="center" label="评论时间" prop="commentTime"></el-table-column>
    <el-table-column width="140" align="center" label="评论订单编号" prop="orderId"></el-table-column>
    <el-table-column width="140" align="center" label="顾客编号" prop="cusId"></el-table-column>
    <el-table-column width="140" align="center" label="状态" prop="status"></el-table-column>
    <el-table-column width="250" align="center" label="操作">
          <template slot-scope="scope">
      <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">审核通过</el-button>
      <el-button  size="mini"  type="danger"  @click="handleDelete(scope.$index, scope.row)">审核不通过</el-button>
          </template>
    </el-table-column>
  </el-table>

  </div>
</template>

<script>
import {mapActions,mapState} from 'vuex'
import { Notification } from 'element-ui';
export default {
  data() {
    return {};
  },
  computed: {
    ...mapState("comment",['totalData'])
  },
  methods: {
    ...mapActions("comment",['findAll','commentRefuseExamine','commentExamine']),
    handleEdit(index,row) {
        console.log(index,row);
        console.log(row.id);
        console.log(this.commentExamine({commentid:row.id}));
        this.commentExamine({commentid:row.id}).then(()=>{
            Notification({
            type:'success',
            title:'成功',
            message:'保存成功',})
          this.findAll();
    
        }).catch(()=>{
            Notification({
            type:'',
            title:"失败",
            message:"保存失败"
          })
        })
    },
    handleDelete(index,row) {
        console.log(index,row);
        this.commentRefuseExamine({commentid:row.id}).then((res)=>{
            Notification({
            type:'success',
            title:'成功',
            message:'保存成功',})
          this.findAll();
    
        }).catch((err)=>{
            Notification({
            type:'',
            title:"失败",
            message:"保存失败"
          })
        });
      }
  },
  created() {
    this.findAll();
  },
  mounted() {},
};
</script>
<style lang="less" scoped>
</style>